home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / 551-575 / apd566 / source / typing speed tester.amos / typing speed tester.amosSourceCode
AMOS Source Code  |  1994-01-01  |  3KB  |  100 lines

  1. '   ______________________________________________________________________ 
  2. '  |                                                                      |
  3. '  |                          TYPING SPEED TESTER                         |
  4. '  |                          ~~~~~~~~~~~~~~~~~~~                         |
  5. '  |             Created for AMOS Basic by Glenn N Babic, 1993            |
  6. '  |                                                                      |
  7. '  |    Use ASCII Reader.AMOS to read "ASCII/Typing Speed Tester.doc"     |
  8. '  |______________________________________________________________________|
  9.  
  10. ' Activate the next command by deleting the ' if you want words to be  
  11. ' counted every five characters instead of at normal space boundaries... 
  12.  
  13. 'M0DE=True 
  14.  
  15. D_TIME#=5.0
  16. Fix 2
  17.  
  18. ' Set Up Screen...   
  19. Hide : Screen Open 0,640,242,2,Hires
  20. Palette $FFF,$0 : Colour Back $FFF
  21.  
  22. ' Main Program Loop...   
  23. Do 
  24.  
  25.    ' Print Information Bar At Top Of Screen...
  26.    Cls 
  27.    Print String$("=",80);
  28.    Print 
  29.    Print 
  30.    Print 
  31.    Print String$("=",80)
  32.    Set Text 3
  33.    Text 168,17,"T Y P I N G   S P E E D   T E S T E R"
  34.    Set Text 4
  35.    Text 196,28,"Written by Glenn N Babic, 1993"
  36.    Print 
  37.    
  38.    ' Prompt For Test Time...  
  39.    Put Key Str$(D_TIME#)-" "
  40.    Input "How many minutes for test? >";D_TIME#
  41.    TIME#=D_TIME#
  42.    Exit If TIME#=0
  43.    Wait 5 : Clear Key 
  44.    Print : Print "Start typing when ready..."
  45.    Print 
  46.    L$="" : S$="" : Repeat : L$=Inkey$ : Until L$<>"" : Put Key L$
  47.    Timer=0
  48.    
  49.    ' Text Entering Loop...  
  50.    Repeat 
  51.       L$=Inkey$ : L=Asc(L$) : S=Scancode
  52.       If S or L
  53.          If(L>31 and L<126) or L=13 or L=9
  54.             If L<>9 : S$=S$+L$ : End If 
  55.             If L=13 : S$=S$+" " : Print : End If 
  56.             If L=9 : L$="     " : End If 
  57.             Print L$;
  58.          Else 
  59.             Bell 1
  60.          End If 
  61.       End If 
  62.       If L=27 Then TIME#=Timer/3000.0 : Exit 
  63.    Until Timer>TIME#*3000
  64.    
  65.    ' Stop Test... 
  66.    Print 
  67.    If L<>27 Then Print : Print "STOP TYPING - TIME'S UP !!!"
  68.    Print 
  69.    Bell : Wait 20 : Bell : Clear Key 
  70.    
  71.    ' Calculate Number Of Words... 
  72.    WORDS#=0 : If Right$(S$,1)<>" " Then S$=S$+" "
  73.    If M0DE
  74.       WORDS#=Len(S$)/5.0
  75.    Else 
  76.       For I=1 To Len(S$)
  77.          If Mid$(S$,I,1)=" " and(Mid$(S$,I-1,1)<>" ") : WORDS#=WORDS#+1 : End If 
  78.       Next I
  79.    End If 
  80.    
  81.    ' Prompt For Number Of Words And Mistyped Words... 
  82.    Put Key Str$(WORDS#)-" "
  83.    Input "Number of words typed? >";WORDS#
  84.    Input "Number of mistyped words? >";BOOBOOS#
  85.    
  86.    ' Print Speed and Accuracy...    
  87.    Print 
  88.    Print "In this";TIME#;" minute test :"
  89.    Print 
  90.    Print "Your typing speed was ";1/TIME#*WORDS#;" wpm"
  91.    Print 
  92.    Print "Your accuracy was     ";(WORDS#-BOOBOOS#)/WORDS#*100.0;" %"
  93.    Print 
  94.    Print "Press any key to continue..."
  95.    Wait Key 
  96.    Clear Key 
  97.  
  98. Loop 
  99.  
  100. Edit